<!DOCTYPE html>
<html>
<head>
    {include file="public/meta"}
	<title>升级会员组 - 个人中心 - {$maccms.site_name}</title>
	<meta name="keywords" content="升级会员组 - 个人中心">
	<meta name="description" content="升级会员组 - 个人中心">
	{include file="public/include"}
</head>
<body id="conch-member">
{include file="public/head"}
<div class="conch-header">
    <div class="conch-headwrap conch-hasone{if$conch['theme']['nav']['has']==1} conch-hasconch{/if} hl-hide-sm">
        <div class="hl-mob-nav">
            <a href="javascript:MAC.GoBack()" class="hl-pull-left left"><i class="iconfont hl-icon-jiantouzuo"></i></a>
            <a href="javascript:void(0)" class="hl-pull-right right"></a>
            <span class="hl-mob-title hl-text-site hl-lc-1">升级会员组</span>
        </div>
    </div>
</div>
<div class="conch-content conch-member">
    <div class="conch-ctwrap">
        <div class="hl-ctwrap-item">
            <div class="container">
                <div class="hl-row-box clearfix">
                    <div class="row">               
                        <div id="left" class="hl-left-menus hl-col-xs-12 hl-col-sm-30w hl-col-lg-3 hl-hidden-xs">
                            {include file="user/leftmenu"}
                        </div>
                        <div id="right" class="hl-right-content hl-col-xs-12 hl-col-sm-70w hl-col-lg-9">
                            <div class="hl-cont-right">
                                <div class="hl-rb-head hl-hidden-xs clearfix">
                                    <h2 class="hl-rb-title">升级会员组</h2>
                                </div>
                                <div class="hl-cont-list">
                                    <div class="hl-list-wrap">
                                        <p><span>所属会员组</span>{if condition="$obj.group_id lt 3"}{$user.group.group_name}{else}<i class="iconfont hl-icon-zuanshi"></i>{$obj.group.group_name}{/if}</p>
                                        <p><span>剩余积分</span>{$obj.user_points}</p>
                                        <p><span>会员期限</span>{if condition="$obj.group_id lt 3"}永久有效{else}{$obj.user_end_time|mac_day}{/if}</p>
                                        <p class="hl-text-muted tip">点击需要的会员组和时长进行购买升级</p>
                                    </div>
                                    <div class="row">
                                        <ul class="hl-upgrade-list clearfix">
                                        {volist name="group_list" id="vo"}
                                            {if condition="$vo.group_id gt 2 && $vo.group_status eq 1"}
                                            <li class="hl-col-xs-6 hl-col-md-3">
                                            <a class="grade day" data-id="{$vo.group_id}" data-name="{$vo.group_name}" data-points="{$vo.group_points_day}" data-long="day">
                                            包天-{$vo.group_name}<span>{$vo.group_points_day}积分</span>
                                            </a></li>
                                            <li class="hl-col-xs-6 hl-col-md-3"><a class="grade week" data-id="{$vo.group_id}" data-name="{$vo.group_name}" data-points="{$vo.group_points_week}" data-long="week">
                                            包周-{$vo.group_name}<span>{$vo.group_points_week}积分</span>
                                            </a></li>
                                            <li class="hl-col-xs-6 hl-col-md-3"><a class="grade month" data-id="{$vo.group_id}" data-name="{$vo.group_name}" data-points="{$vo.group_points_month}" data-long="month">
                                            包月-{$vo.group_name}<span>{$vo.group_points_month}积分</span>
                                            </a></li>
                                            <li class="hl-col-xs-6 hl-col-md-3"><a class="grade year" data-id="{$vo.group_id}" data-name="{$vo.group_name}" data-points="{$vo.group_points_year}" data-long="year">
                                            包年-{$vo.group_name}<span>{$vo.group_points_year}积分</span>
                                            </a></li>
                                            {/if}
                                        {/volist}
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
<script>
    $('.grade').click(function(){
        var that=$(this);
        var group_id = that.attr('data-id');
        var group_name = that.attr('data-name');
        var long = that.attr('data-long');
        var points = that.attr('data-points');

        if(confirm('确定要升级到【'+group_name+'】吗,需要花费【'+points+'】积分')) {
            $.ajax({
                url: "{:url('user/upgrade')}",
                type: "post",
                dataType: "json",
                data: {group_id: group_id,long:long },
                beforeSend: function () {
                    $("#btn_submit").css("background","#fd6a6a").val("loading...");
                },
                success: function (r) {
                    alert(r.msg);
                    if (r.code == 1) {
                        location.reload();
                    }
                },
                complete: function () {
                    $("#btn_submit").css("background","#fa4646").val("提交");
                }
            });
        }
    });
</script>
</div>
{include file="public/foot"}
</body>
</html>